
import request from '@/router/axios'

//  列表获取用户信息
export function getUserListNoRole(query) {
  return request({
    url: '/admin/user/list',
    method: 'get',
    params: query
  })
}

//  根据菜单获取用户列表
export function getUserListByMenu(query) {
  return request({
    url: '/admin/user/getUserListByMenu',
    method: 'get',
    params: query
  })
}

export function fetchList(query) {
  return request({
    url: '/admin/user/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  console.log(obj)
  return request({
    url: '/admin/user',
    method: 'post',
    data: obj
  })
}
export function addUserObj(obj) {
  return request({
    url: '/admin/user',
    method: 'post',
    data: obj
  })
}

export function updateUserObj(obj) {
  return request({
    url: '/admin/user',
    method: 'put',
    data: obj
  })
}

//  获取用户信息
export function getUserObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'get'
  })
}

//  获取用户信息
export function userInfo() {
  return request({
    url: '/admin/user/info',
    method: 'get'
  })
}

export function getObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'delete'
  })
}
export function delUserObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/admin/user',
    method: 'put',
    data: obj
  })
}

export function putUserObj(obj) {
  return request({
    url: '/admin/user',
    method: 'put',
    data: obj
  })
}
//  更新用户权限
export function updateUserOrg(obj) {
  return request({
    url: '/admin/user/saveUserOrg',
    method: 'put',
    data: obj
  })
}

//根据username获取员工信息
export function getDetails(obj) {
  return request({
    url: '/admin/user/details/' + obj,
    method: 'get'
  })
}

//根据工号获取员工信息
export function getUserInfo(workNumber) {
  return request({
    url: '/admin/user/getDetails/' + workNumber,
    method: 'get'
  })
}


//根据部门id获取员工信息集合
export function getUserByDeptIdAndJobType(data) {
  return request({
    url: '/admin/user/getUserByDeptIdAndJobType',
    method: 'get',
    params: data
  })
}

//根据员工工作类型获取员工信息集合
export function getUserListByJobType(jobType) {
  return request({
    url: '/admin/user/getUserByJobType'+ jobType,
    method: 'get'
  })
}
